/*    */ package com.zimbra.cs.service.admin;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.soap.AdminConstants;
/*    */ import com.zimbra.common.soap.Element;
/*    */ import com.zimbra.cs.account.accesscontrol.AdminRight;
/*    */ import com.zimbra.cs.session.IWaitSet;
/*    */ import com.zimbra.cs.session.WaitSetMgr;
/*    */ import com.zimbra.soap.ZimbraSoapContext;
/*    */ import java.util.ArrayList;
/*    */ import java.util.List;
/*    */ import java.util.Map;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class QueryWaitSet
/*    */   extends AdminDocumentHandler
/*    */ {
/*    */   public Element handle(Element request, Map<String, Object> context)
/*    */     throws ServiceException
/*    */   {
/* 43 */     ZimbraSoapContext zsc = getZimbraSoapContext(context);
/* 44 */     WaitSetMgr.checkRightForAllAccounts(zsc);
/*    */     
/* 46 */     Element response = zsc.createElement(AdminConstants.QUERY_WAIT_SET_RESPONSE);
/*    */     
/* 48 */     String waitSetId = request.getAttribute("waitSet", null);
/*    */     
/*    */     List<IWaitSet> sets;
/*    */     
/* 52 */     if (waitSetId != null) {
/* 53 */       List<IWaitSet> sets = new ArrayList(1);
/* 54 */       IWaitSet ws = WaitSetMgr.lookup(waitSetId);
/* 55 */       if (ws == null) {
/* 56 */         throw AdminServiceException.NO_SUCH_WAITSET(waitSetId);
/*    */       }
/* 58 */       sets.add(ws);
/*    */     } else {
/* 60 */       sets = WaitSetMgr.getAll();
/*    */     }
/*    */     
/* 63 */     for (IWaitSet set : sets) {
/* 64 */       Element waitSetElt = response.addElement("waitSet");
/* 65 */       set.handleQuery(waitSetElt);
/*    */     }
/* 67 */     return response;
/*    */   }
/*    */   
/*    */   public void docRights(List<AdminRight> relatedRights, List<String> notes)
/*    */   {
/* 72 */     notes.add("Only system admins are allowed.");
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/service/admin/QueryWaitSet.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */